<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>String类</title>
</head>
<body>

<script>
  /*concat*/
  let str1 = "abc";
  let str2 = "def";
  let total = str1.concat(str2);
  console.log(total.toString());
  /*charAt*/
  let str3 = "abcdefg";
  console.log("charAt()方法: " + str3.charAt(2));
  /*indexOf*/
  console.log("indexOf()方法: " + str3.indexOf("c"));
  /*split*/
  let arrs = "a-b-c-d";
  let arr = arrs.split("-");
  console.log("split: " + arr.length);
  /*replace*/
  let str4 = "faker";
  let txt = str4.replace("a","Q");
  console.log("replace方法: " + txt);
  /*substr*/
  let str5 = "crown";
  let substrs = str5.substr(0,3);
  console.log(substrs);
  /*substring*/
  let str6 = "ambition";
  let sbt = str6.substring(0,3);
  console.log(sbt);
  /*
  *  concat() // 连接字符串
  *  charAt //  返回指定位置的字符串
  *  indexOf() // 返回一个指定字符串的位置     如果字符串不存在,会返回-1
  *  split() // 切分字符成 数组
  *  replace() 替换字符串,里面需要两个参数,第一个是原始值,第二个是替换的新值  或 正则表达式匹配的子串
  *  substr() 指定起始下标和结尾下标进行截取,结尾从开始的结束点开始计算  和  substring() 开始和结尾都从开始计算,但是不包含最后一位
  * */

</script>
</body>
</html>
